load("//tools/lint:lint.bzl", "add_lint_tests")
load(
    "//tools/skylark:drake_cc.bzl",
    "drake_cc_binary",
    "drake_cc_googletest",
    "drake_cc_library",
)
load(
    "//tools/skylark:drake_py.bzl",
    "drake_py_unittest",
)

package(default_visibility = ["//visibility:private"])

drake_cc_binary(
    name = "allegro_single_object_simulation",
    srcs = ["allegro_single_object_simulation.cc"],
    data = [
        ":simple_mug.sdf",
        "@drake_models//:allegro_hand_description",
    ],
    deps = [
        "//common:add_text_logging_gflags",
        "//examples/allegro_hand:allegro_common",
        "//examples/allegro_hand:allegro_lcm",
        "//lcmtypes:lcmtypes_drake_cc",
        "//math:geometric_transform",
        "//multibody/parsing",
        "//multibody/plant",
        "//multibody/plant:contact_results_to_lcm",
        "//systems/analysis:simulator",
        "//systems/analysis:simulator_gflags",
        "//systems/controllers:pid_controller",
        "//systems/framework:diagram",
        "//systems/lcm:lcm_pubsub_system",
        "//systems/primitives:matrix_gain",
        "//visualization",
        "@gflags",
    ],
)

drake_cc_binary(
    name = "run_twisting_mug",
    srcs = ["run_twisting_mug.cc"],
    deps = [
        "//examples/allegro_hand:allegro_common",
        "//examples/allegro_hand:allegro_lcm",
        "//lcm:drake_lcm",
        "//lcmtypes:lcmtypes_drake_cc",
        "@gflags",
    ],
)

drake_py_unittest(
    name = "run_twisting_mug_test",
    timeout = "moderate",
    allow_network = ["lcm:meshcat"],
    args = select({
        "//tools/cc_toolchain:debug": ["--compilation_mode=dbg"],
        "//conditions:default": ["--compilation_mode=opt"],
    }),
    data = [
        ":allegro_single_object_simulation",
        ":run_twisting_mug",
    ],
    flaky = True,
    deps = [
        "@rules_python//python/runfiles",
    ],
)

add_lint_tests()
